﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
namespace DataHandle
{
    public class Funcs
    {
        public static bool FileIsInUse(string filePath)
        {
            bool bInUse = true;
            FileStream FS = null;
            try
            {
                FS = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.None);
                bInUse = false;
            }
            catch
            {
                
            }
            finally
            {
                if (FS != null)
                {
                    FS.Close();
                }
            }
            return bInUse;
        }
        /// <summary>
        /// 获取当前版本号
        /// </summary>
        /// <returns></returns>
        public static string GetSftVersion()
        {
            Assembly AppAssembly = Assembly.GetExecutingAssembly();
            return string.Format("{0}", AppAssembly.GetName().Version);
        }
    }
}
